const state = () => ({
  searchCollegeData: {
    selectedCollege: [],
  },
});

// getters
const getters = {};

// actions
const actions = {
  setCollegeLike({ commit }, collegeList) {
    commit('set_collegeLike', collegeList);
  },
  setCollegePush({ commit }, college) {
    commit('set_collegeLike', college);
  },
  removeCollegeList({ commit }, index) {
    commit('set_removeCollege', index);
  },
};

// mutations
const mutations = {
  set_collegeLike: (state, collegeList) => {
    state.searchCollegeData.selectedCollege = collegeList;
  },
  set_collegeLikePush: (state, college) => {
    state.searchCollegeData.selectedCollege.push(college);
  },
  set_removeCollege: (state, index) => {
    state.searchCollegeData.selectedCollege.splice(index, 1);
  },
};

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations,
};
